package com.dwzlab.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dwzlab.vo.XUser;


/**
 * @author zhuxiaodong
 *
 */
public class LookUpBackAjax extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String opt = request.getParameter("opt");
		if("filter".equals(opt)){
			List<XUser> xUsers = new ArrayList<XUser>();
			for(int i=0;i<3;i++){
				XUser xUser = new XUser();
				xUser.setId(i);
				xUser.setE_name("merry"+i);
				xUsers.add(xUser);
			}
			request.setAttribute("xusers", xUsers);
			request.getRequestDispatcher("lookupback1.jsp").forward(request, response);
		}else if("ckb".equals(opt)){
			List<XUser> xUsers = new ArrayList<XUser>();
			for(int i=0;i<5;i++){
				XUser xUser = new XUser();
				xUser.setId(i);
				xUser.setE_name("merry"+i);
				xUsers.add(xUser);
			}
			request.setAttribute("xusers", xUsers);
			request.getRequestDispatcher("lookupbackckb.jsp").forward(request, response);
		}
		else{
			List<XUser> xUsers = new ArrayList<XUser>();
			for(int i=0;i<5;i++){
				XUser xUser = new XUser();
				xUser.setId(i);
				xUser.setE_name("merry"+i);
				xUsers.add(xUser);
			}
			request.setAttribute("xusers", xUsers);
			request.getRequestDispatcher("lookupback1.jsp").forward(request, response);
		}
	}

}
